import java.sql.*;

public class DBHelper {
    //开门
    public static Connection getConn() throws Exception {
        //1. 搭桥
        Class.forName("com.mysql.cj.jdbc.Driver");
        //2. 开门
        Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/st0104?useSSL=false&serverTimezone=UTC", "root", "123456");
        return conn;
    }
    //关门
    public static void close(PreparedStatement ps,Connection conn) throws Exception {
        ps.close();
        conn.close();
    }
    public static void close(ResultSet rs,PreparedStatement ps, Connection conn) throws Exception {
        rs.close();
        ps.close();
        conn.close();
    }



}
